package com.link2room.soundwave.controller.manager;

import com.link2room.common.dto.param.base.BaseParamDto;
import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.sideswipe.permissionResouces.annotation.L2RPermissionResources;
import com.link2room.soundwave.dto.result.base.L2RPmsCouponDto;
import com.link2room.soundwave.util.HandlerUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import static com.link2room.soundwave.constant.PermissionConstant.L2RPMSPackage;
import static com.link2room.soundwave.constant.PermissionConstant.L2RPMSPackageList;

/**
 * @author sqj88
 * @date 2018/1/4 17:14
 */
@Api(tags = "联房-PMS礼包")
@RestController
@RequestMapping("/manager/L2RPmsPackages")
public class L2RPMSPackageManagerController {

    @ApiOperation(value ="获取联房PMS礼包列表")
    @RequestMapping(method = RequestMethod.GET)
    @L2RPermissionResources(value = L2RPMSPackageList,name = "获取联房PMS礼包列表")
    public BaseResultDto<L2RPmsCouponDto> listL2RPMSCouponList() throws Exception{
        BaseParamDto baseParamDto=new BaseParamDto();
        baseParamDto.setPageSize(100);
        BaseResultDto baseResultDto = new BaseResultDto();
        baseResultDto.setResultCode(0);
        baseResultDto.setQueryResult(HandlerUtil.pmsMemberHandler().listPmsPackageHandler(baseParamDto));
        return  baseResultDto;
    }

    @ApiOperation(value ="获取联房PMS礼包")
    @ApiImplicitParam(name="id",value="礼包id",dataType="Long", paramType = "path",example="12")
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    @L2RPermissionResources(value = L2RPMSPackage,name = "获取联房PMS礼包")
    public BaseResultDto<L2RPmsCouponDto> getL2RPMSCoupon(
            @PathVariable Long id
    ) throws Exception{
        BaseParamDto baseParamDto=new BaseParamDto();
        baseParamDto.setId(id);
        BaseResultDto baseResultDto = new BaseResultDto();
        baseResultDto.setResultCode(0);
        baseResultDto.setResultInfo(HandlerUtil.pmsMemberHandler().getPmsPackageHandler(baseParamDto));
        return  baseResultDto;
    }
}
